package controller;

import dao.ArticleDao;
import model.Article;
import jakarta.servlet.*;
import jakarta.servlet.http.*;
import java.io.IOException;
import java.util.List;

public class ArticleListServlet extends HttpServlet {
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        ArticleDao dao = new ArticleDao();
        List<Article> list = dao.getAllArticles();

        request.setAttribute("articleList", list);
        request.getRequestDispatcher("index.jsp").forward(request, response);
    }
}
